//
//  Tool.m
//  child
//
//  Created by lijianguomac on 13-9-24.
//  Copyright (c) 2013年 lijianguomac. All rights reserved.
//

#import "Tool.h"

@implementation Tool

+(NSString *)appVersion{
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
    NSMutableDictionary *dict = [[[NSMutableDictionary alloc] initWithContentsOfFile: plistPath] autorelease];
	NSString *version = [dict objectForKey: @"CFBundleVersion"];
    return version;
}

+(int)getValidViewHeight:(UITabBarController *)tabBarController nar:(UINavigationController *)nar{
    int height = 0;
    //    app尺寸，去掉状态栏
    CGRect r = [ UIScreen mainScreen ].applicationFrame;
    height = r.size.height;
    
    r = tabBarController.tabBar.frame;
    height = height - r.size.height;
    
    r = nar.navigationBar.frame;
    
    height = height - r.size.height;
    return  height;
}
+(void)setViewShadow:(UIView *) view borderWidth:(float)borderWidth{
    CALayer *layer = [view layer];
    layer.borderColor = [[UIColor whiteColor] CGColor];
    layer.borderWidth = borderWidth;
    view.layer.shadowColor = [UIColor blackColor].CGColor;
    view.layer.shadowOffset = CGSizeMake(2, 2);
    view.layer.shadowOpacity = 0.5;
    view.layer.shadowRadius = 1.0;
    view.layer.cornerRadius = 3.0;
}
@end
